package com.frogs.ucenter.entity;

import java.io.Serializable;
import java.util.Date;

import org.codehaus.jackson.map.annotate.JsonSerialize;

import com.alibaba.fastjson.JSON;
import com.frogs.framework.util.StringUtil;
import com.frogs.framework.util.date.DateUtil;
import com.frogs.ucenter.util.DateJsonSerializer;

public class UserBaseAccountInfo implements Serializable {

	private static final long serialVersionUID = -635136327943676064L;
	
	private Integer id;
	
	private String accountName;
	
	private String email;
	
	private Integer isEmailValid;

	private String phone;
	
	private Integer isPhoneValid;
	
	private String nickName;
	
	private String headImageUrl;
	
	private Integer userType;
	
	private Integer sex;
	
	private String realName;
	
	private String identityCard;
	
	private Integer identityType;
	
	private String defaultAddress;
	
	private String defaultPhone;
	
	private Integer defaultContactWay;
	
	private String verify;
	
	private Long createTime;
	
	private Integer age;
	
	private Date birthday;
	
	private String tags;
	
	private Integer height;
	
	private Integer weight;
	
    private Integer isAuthorized;
    
    private Integer isNovice;
	
	public UserBaseAccountInfo() {
	}
	
	@JsonSerialize(using=DateJsonSerializer.class)
	public Date getBirthday() {
		return birthday;
	}
	
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	@Override
	public String toString() {
		return JSON.toJSONString(this);
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getAccountName() {
		return accountName;
	}

	public void setAccountName(String accountName) {
		this.accountName = accountName;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getNickName() {
		return nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	public String getHeadImageUrl() {
		return headImageUrl;
	}

	public void setHeadImageUrl(String headImageUrl) {
		this.headImageUrl = headImageUrl;
	}

	public Integer getUserType() {
		return userType;
	}

	public void setUserType(Integer userType) {
		this.userType = userType;
	}

	public Integer getSex() {
		return sex;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	public String getIdentityCard() {
		return identityCard;
	}

	public void setIdentityCard(String identityCard) {
		this.identityCard = identityCard;
	}

	public Integer getIdentityType() {
		return identityType;
	}

	public void setIdentityType(Integer identityType) {
		this.identityType = identityType;
	}

	public String getDefaultAddress() {
		return defaultAddress;
	}

	public void setDefaultAddress(String defaultAddress) {
		this.defaultAddress = defaultAddress;
	}

	public String getDefaultPhone() {
		return defaultPhone;
	}

	public void setDefaultPhone(String defaultPhone) {
		this.defaultPhone = defaultPhone;
	}

	public Integer getDefaultContactWay() {
		return defaultContactWay;
	}

	public void setDefaultContactWay(Integer defaultContactWay) {
		this.defaultContactWay = defaultContactWay;
	}

	public String getVerify() {
		return verify;
	}

	public void setVerify(String verify) {
		this.verify = verify;
	}

	public Integer getIsEmailValid() {
		return isEmailValid;
	}

	public void setIsEmailValid(Integer isEmailValid) {
		this.isEmailValid = isEmailValid;
	}

	public Integer getIsPhoneValid() {
		return isPhoneValid;
	}

	public void setIsPhoneValid(Integer isPhoneValid) {
		this.isPhoneValid = isPhoneValid;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
	public Long getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Long createTime) {
		this.createTime = createTime;
	}

	public Integer getAge() {
		if(this.age > 0 || StringUtil.isEmpty(this.birthday)) {
			return age;
		} else if (!StringUtil.isEmpty(this.birthday)) {
			return DateUtil.getIntervalDays(this.birthday,new Date())/365;
		} else {
			return age;
		}
	}
	
	public void setAge(Integer age) {
		this.age = age;
	}

	public String getTags() {
		return tags;
	}

	public void setTags(String tags) {
		this.tags = tags;
	}

	public Integer getHeight() {
		return height;
	}

	public void setHeight(Integer height) {
		this.height = height;
	}

	public Integer getWeight() {
		return weight;
	}

	public void setWeight(Integer weight) {
		this.weight = weight;
	}

	public Integer getIsAuthorized() {
		return isAuthorized;
	}

	public void setIsAuthorized(Integer isAuthorized) {
		this.isAuthorized = isAuthorized;
	}

	public Integer getIsNovice() {
		return isNovice;
	}

	public void setIsNovice(Integer isNovice) {
		this.isNovice = isNovice;
	}
	
	
}
